'use strict';

const Service = require('egg').Service;

class ConfigService extends Service {
  async single(tid) {
    return await this.ctx.model.Config.findOne({
      where: { tid },
    });
  }
  async edit(params) {
    await this.ctx.model.Config.update({
      flag: params.flag,
      refreshtime: params.refreshtime,
      days: params.days,
    }, { where: { id: params.id } });
  }
  async finOffLineOnu(tid){
   const Op = this.ctx.modelmysql.Sequelize.Op;

    let offLineOnu = await this.ctx.model.OnuList.find({status:{$ne:"working"},tid});
   return offLineOnu
  }
}

module.exports = ConfigService;
